package com.hly.aidldemo;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

import androidx.annotation.Nullable;

import java.util.Arrays;
import java.util.List;

public class InforService extends Service {

    private final IBinder iBinder = new Information.Stub() {
        @Override
        public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {
            Log.d("******InforService", "Received data: " + anInt + ", " + aLong + ", " + aBoolean + ", " + aFloat + ", " + aDouble + ", " + aString);
        }

        @Override
        public void Infor(String name, int age) throws RemoteException {
            Log.d("******infor", "姓名=" + name + "," + "年龄=" + age);
        }

        @Override
        public boolean isActive() throws RemoteException {
            return true;
        }

        @Override
        public List<String> getList() throws RemoteException {
            return Arrays.asList("A", "B", "C", "D");
        }
    };

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        Log.d("******Bind service:", String.valueOf(intent));
        return iBinder;
    }
}
